<div class="wrapper-bz-page">
    <div class="wrapper-bz-body">
        <div class="column-block block-left" style="width:390px;">
            <div class="column-title">电影</div>
            <div class="column-content">
                <div class="column-filter">
                    <div class="common-search-box">
                        <input style="width:120px" id="search_input_lib_movie_in_m62"/>
                    </div>
                </div>
                <div class="column-datagrid">
                    <table id="table_lib_movie_in_m62" style="width:100%;height:100%"></table>
                </div>
            </div>
        </div>
        <div class="column-block block-left" style="left:400px; width:300px;">
            <div class="column-title">单词</div>
            <div class="column-content">
                <div class="column-filter">
                    <div class="common-search-box">
                        <input style="width:120px" id="search_input_lib_movie_word_in_m62"/>
                    </div>
                </div>
                <div class="column-datagrid">
                    <table id="table_lib_movie_word_in_m62" style="width:100%;height:100%"></table>
                </div>
            </div>
        </div>
        <div class="column-block block-right" style="left:710px;">
            <div class="column-block block-up" style="height:400px;">
                <div class="column-block block-left" style="width: 150px;">
                    <div class="column-title">词性</div>
                    <div class="column-content">
                        <div class="column-datagrid no-filter">
                            <table id="table_lib_word_en_type_in_m62" style="width:100%;height:100%"></table>
                        </div>
                    </div>
                </div>
                <div class="column-block block-right" style="left:160px;">
                    <div class="column-title">释义</div>
                    <div class="column-content">
                        <div class="column-datagrid no-filter">
                            <table id="table_lib_word_en_meaning_in_m62" style="width:100%;height:100%"></table>
                        </div>
                    </div>
                </div>
            </div>
            <div class="column-block block-down" style="top:410px;">
                <div class="column-title">字幕</div>
                <div class="column-content">
                    <div class="column-datagrid no-filter">
                        <table id="table_lib_movie_subtitle_in_m62" style="width:100%;height:100%"></table>
                    </div>
                </div>
            </div>
        </div>

    </div>
</div>
<div id="dialog_add_lib_movie_subtitle_in_m62"></div>
<div id="dialog_edit_lib_movie_subtitle_in_m62"></div>
<div id="dialog_add_lib_movie_word_in_m62"></div>

<script>
    $(function () {
        var subject_1 = "lib_movie_in_m62";
        var subject_2 = "lib_movie_word_in_m62";
        var subject_3 = "lib_word_en_type_in_m62";
        var subject_4 = "lib_word_en_meaning_in_m62";
        var subject_5 = "lib_movie_subtitle_in_m62";

        //列表-对话框-表单
        var tableId_1 = 'table_' + subject_1;
        var tableId_2 = 'table_' + subject_2;
        var tableId_3 = 'table_' + subject_3;
        var tableId_4 = 'table_' + subject_4;
        var tableId_5 = 'table_' + subject_5;

        var searchInputId_1 = 'search_input_' + subject_1;
        var searchInputId_2 = 'search_input_' + subject_2;
        var searchInputId_3 = 'search_input_' + subject_3;

        var tableObject_1 = $('#' + tableId_1);
        var tableObject_2 = $('#' + tableId_2);
        var tableObject_3 = $('#' + tableId_3);
        var tableObject_4 = $('#' + tableId_4);
        var tableObject_5 = $('#' + tableId_5);

        var addDialogId_1 = '#dialog_add_' + subject_1;
        var addDialogId_2 = '#dialog_add_' + subject_2;
        var addDialogId_3 = '#dialog_add_' + subject_3;
        var editDialogId_2 = '#dialog_edit_' + subject_2;
        var editDialogId_3 = '#dialog_edit_' + subject_3;

        var addFormId_1 = '#form_add_' + subject_1;
        var addFormId_2 = '#form_add_' + subject_2;
        var addFormId_3 = '#form_add_' + subject_3;
        var editFormId_2 = '#form_edit_' + subject_2;
        var editFormId_3 = '#form_edit_' + subject_3;

        var paramDataAdd_1 = {};
        var paramDataAdd_2 = {};
        var paramDataAdd_3 = {};
        var paramDataEdit_2 = {};
        var paramDataEdit_3 = {};

        var selectLeftMainId = 0;
        var configDialogAdd_1 = {
            href: '/admin/DatagridCustom/pageAdd',
            title: '新增数据表',
            queryParams: {},
            width: dialogDefaultWidth,
            height: dialogDefaultHeight,
            modal: true,
            buttons: [{
                text: '<i class="fa fa-check fa-btn-cls" style="color:green"></i>保存',
                plain: true,
                handler: function () {
                    paramDataAdd_1 = $(addFormId_1).serializeObject();
                    if (!paramDataAdd_1.datagrid_name) {
                        layer.msg("请填写数据表名称");
                        return;
                    }

                    if (!paramDataAdd_1.menu_id) {
                        layer.msg("请选择菜单");
                        return;
                    }
                    if (!paramDataAdd_1.table_id) {
                        layer.msg("请选择数据表");
                        return;
                    }

                    var loading = layer.load(1, {
                        shade: [0.1, '#fff'] //0.1透明度的白色背景
                    });
                    $.ajax({
                        url: '/api/DatagridCustom/addDatagridCustom',
                        async: false,
                        dataType: 'json',
                        type: 'post',
                        data: paramDataAdd_1,
                        success: function (resp) {
                            layer.close(loading);
                            if (1 == resp.code) {
                                $(addDialogId_1).dialog('close');
                                $(tableId_1).datagrid('reload');
                            } else {
                                layer.msg(resp.message);
                            }
                        }
                    });
                }
            }, {
                text: '<i class="fa fa-times fa-btn-cls" style="color:red"></i>取消',
                plain: true,
                handler: function () {
                    $(addDialogId_1).dialog('close');
                }
            }]
        };

        var configDialogAdd_2 = {
            href: '/admin/LibMovieWord/pageAdd',
            title: '新增电影单词',
            queryParams: {},
            width: dialogDefaultWidth,
            height: dialogDefaultHeight,
            modal: true,
            buttons: []
        };
        var configDialogAdd_3 = {
            href: '/admin/DatagridToolbar/pageAdd',
            title: '新增页面工具栏',
            queryParams: {},
            width: dialogDefaultWidth,
            height: dialogDefaultHeight,
            modal: true,
            buttons: [{
                text: '<i class="fa fa-check fa-btn-cls" style="color:green"></i>保存',
                plain: true,
                handler: function () {
                    paramDataAdd_3 = $(addFormId_3).serializeObject();
                    paramDataAdd_3 = $.extend(paramDataAdd_3, {datagrid_id: selectLeftMainId});
                    console.log(paramDataAdd_3);
                    if (!paramDataAdd_3.button_type) {
                        layer.msg("请填写类型");
                        return;
                    }
                    if (!paramDataAdd_3.button_text) {
                        layer.msg("请填写名称");
                        return;
                    }
                    var loading = layer.load(1, {
                        shade: [0.1, '#fff'] //0.1透明度的白色背景
                    });
                    $.ajax({
                        url: '/api/DatagridToolbar/addPageToolbar',
                        async: false,
                        dataType: 'json',
                        type: 'post',
                        data: paramDataAdd_3,
                        success: function (resp) {
                            layer.close(loading);
                            if (1 == resp.code) {
                                $(addDialogId_3).dialog('close');
                                tableObject_3.datagrid('reload');
                            } else {
                                layer.msg(resp.message);
                            }
                        }
                    });
                }
            }, {
                text: '<i class="fa fa-times fa-btn-cls" style="color:red"></i>取消',
                plain: true,
                handler: function () {
                    $(addDialogId_3).dialog('close');
                }
            }]
        };
        var configDialogEdit = {
            href: 'role/edit',
            title: '修改角色',
            queryParams: {},
            width: dialogDefaultWidth,
            height: dialogDefaultHeight,
            modal: true,
            buttons: [{
                text: '<i class="fa fa-check fa-btn-cls" style="color:green"></i>保存',
                plain: true,
                handler: function () {
                    paramDataEdit = $(editFormId).serializeObject();
                    console.log(paramDataEdit);
                    if (!paramDataEdit.role_name) {
                        layer.msg("请填写角色名称");
                        return;
                    }
                    var loading = layer.load(1, {
                        shade: [0.1, '#fff'] //0.1透明度的白色背景
                    });
                    $.ajax({
                        url: '/api/role/edit',
                        async: false,
                        dataType: 'json',
                        type: 'post',
                        data: paramDataEdit,
                        success: function (resp) {
                            layer.close(loading);
                            if (1 == resp.code) {
                                $(editDialogId).dialog('close');
                                $(tableId).datagrid('reload');
                            } else {
                                layer.msg(resp.message);
                            }
                        }
                    });
                }
            }, {
                text: '<i class="fa fa-times fa-btn-cls" style="color:red"></i>取消',
                plain: true,
                handler: function () {
                    $(editDialogId).dialog('close');
                }
            }]
        };
        var configDialogEdit_3 = {
            href: '/admin/DatagridToolbar/pageEdit',
            title: '编辑页面工具栏',
            queryParams: {},
            width: dialogDefaultWidth,
            height: dialogDefaultHeight,
            modal: true,
            buttons: [{
                text: '<i class="fa fa-check fa-btn-cls" style="color:green"></i>保存',
                plain: true,
                handler: function () {
                    paramDataEdit_3 = $(editFormId_3).serializeObject();
                    console.log(paramDataEdit_3);
                    if (!paramDataEdit_3.button_type) {
                        layer.msg("请填写类型");
                        return;
                    }
                    if (!paramDataEdit_3.button_text) {
                        layer.msg("请填写名称");
                        return;
                    }
                    var loading = layer.load(1, {
                        shade: [0.1, '#fff'] //0.1透明度的白色背景
                    });
                    $.ajax({
                        url: '/api/DatagridToolbar/editPageToolbar',
                        async: false,
                        dataType: 'json',
                        type: 'post',
                        data: paramDataEdit_3,
                        success: function (resp) {
                            layer.close(loading);
                            if (1 == resp.code) {
                                $(editDialogId_3).dialog('close');
                                tableObject_3.datagrid('reload');
                            } else {
                                layer.msg(resp.message);
                            }
                        }
                    });
                }
            }, {
                text: '<i class="fa fa-times fa-btn-cls" style="color:red"></i>取消',
                plain: true,
                handler: function () {
                    $(editDialogId_3).dialog('close');
                }
            }]
        };

        var configDatagrid_1 = {
            url: '/api/LibMovie/getLibMovieList',
            method: 'post',
            remoteSort: false,
            queryParams: {},
            pageList: [25, 50, 100],
            pageSize: 25,
            pagination: true,
            clickToEdit: false,
            dblclickToEdit: false,
            singleSelect: true,
            checkOnSelect: true,
            selectOnCheck: true,
            rownumbers: false,
            striped: true,
            fitColumns: true,
            fit: true,
            frozenColumns: [[]],
            columns: [[
                {field: 'id', title: 'ID', width: 40, hidden: true},
                {field: 'movie_name_cn', title: '片名', width: 100},
            ]],
            loadFilter: function (data) {
                return loadFilter(data, true);
            },
            onSelect: function (index, row) {
                configDatagrid_2.queryParams = {movie_id: row.id};
                tableObject_2.datagrid(configDatagrid_2);
                SearchCombobox(searchInputId_2, tableId_2, function (val, name) {
                    configDatagrid_2.queryParams[name] = val;
                    configDatagrid_2.datagrid(configDatagrid_2);
                }, ['ID', '单词ID']);
                selectLeftMainId = row.id;
            },
            onClickRow: function (index, row) {
                // console.log("enter click row");
                // selectLeftMainId = row.id;
                // configDatagrid_2.queryParams = {datagrid_id:row.id};
                // tableObject_2.datagrid(configDatagrid_2);
            },
            onCheck: function (index, row) {
            },
            onUncheck: function (index, row) {
            },
            onLoadSuccess: function () {
                tableObject_1.datagrid('selectRow', 0);
            },
            toolbar: [
                {
                    text: '<span class="tool-btn-refresh"><i class="fa fa-refresh"></i>刷新</span>',
                    plain: true,
                    handler: function () {
                        tableObject_1.datagrid('reload');
                    }
                },
                {
                    text: '<span class="tool-btn-add"><i class="fa fa-plus"></i>新增</span>',
                    plain: true,
                    handler: function () {
                        $(addDialogId_1).dialog(configDialogAdd_1);
                    }
                },

            ]

        };
        var configDatagrid_2 = {
            url: '/api/LibMovieWord/getLibMovieWordList',
            method: 'post',
            remoteSort: false,
            queryParams: {},
            pageList: [30, 50, 100],
            pageSize: 30,
            pagination: true,
            clickToEdit: false,
            dblclickToEdit: true,
            singleSelect: true,
            checkOnSelect: false,
            selectOnCheck: false,
            rownumbers: false,
            striped: true,
            frozenColumns: [[]],
            fit:true,
            fitColumns:true,
            columns: [[
                {field: 'id', title: 'ID', width: 40, hidden: true},
                {field: 'word_id', title: '单词ID', width: 40, hidden: true},
                {field: 'spelling', title: '单词', width:100},
            ]],
            loadFilter: function (data) {
                return loadFilter(data, true);
            },
            onCheck: function (index, row) {
            },
            onSelect: function(index, row){
                configDatagrid_3.queryParams = {word_id: row.word_id};
                tableObject_3.datagrid(configDatagrid_3);

                //单词相关字幕
                configDatagrid_5.queryParams = {movie_id: selectLeftMainId, spelling:row.spelling};
                tableObject_5.datagrid(configDatagrid_5);
            },
            onUncheck: function (index, row) {
            },
            onLoadSuccess: function () {
                tableObject_2.datagrid('selectRow', 0);
            },
            toolbar: [
                {
                    text: '<span class="tool-btn-refresh"><i class="fa fa-refresh"></i>刷新</span>',
                    plain: true,
                    handler: function () {
                        tableObject_2.datagrid('reload');
                    }
                },
                {
                    text: '<span class="tool-btn-edit"><i class="fa fa-pencil"></i>加词</span>',
                    plain: true,
                    handler: function () {
                        $(addDialogId_2).dialog(configDialogAdd_2);
                    }
                }
            ]

        };
        var configDatagrid_3 = {
            url: '/api/LibWordEnType/getLibWordEnTypeOption',
            method: 'post',
            remoteSort: false,
            queryParams: {},
            pageList: [30, 50, 100],
            pageSize: 30,
            pagination: false,
            clickToEdit: false,
            dblclickToEdit: false,
            singleSelect: true,
            checkOnSelect: false,
            selectOnCheck: true,
            rownumbers: false,
            striped: true,
            fitColumns: true,
            fit: true,
            frozenColumns: [[
                {field: 'ck', title: 'ck', checkbox: true},
            ]],
            columns: [[
                {field: 'id', title: 'ID', width: 40, hidden: true},
                {field: 'speech_text', title: '词性', width: 100},
            ]],
            loadFilter: function (data) {
                return loadFilter(data, false);
            },
            onSelect: function(index, row){
                configDatagrid_4.queryParams = {word_type_id: row.id};
                tableObject_4.datagrid(configDatagrid_4);
            },
            onClickRow: function (index, row) {
                // console.log("enter click row");
                // selectLeftMainId = row.id;
                // configDatagrid_2.queryParams = {datagrid_id:row.id};
                // tableObject_2.datagrid(configDatagrid_2);
            },
            onCheck: function (index, row) {
                var checkList = tableObject_3.datagrid('getChecked');
                if (checkList.length > 1) {
                    $("#btn_edit_in_page_toolbar").linkbutton('disable');
                } else if (1 == checkList.length) {
                    $("#btn_edit_in_page_toolbar").linkbutton('enable');
                    $("#btn_delete_in_page_toolbar").linkbutton('enable');
                }
            },
            onUncheck: function (index, row) {
                var checkList = tableObject_3.datagrid('getChecked');
                if (checkList.length > 1) {
                    $("#btn_edit_in_page_toolbar").linkbutton('disable');
                } else if (1 == checkList.length) {
                    $("#btn_edit_in_page_toolbar").linkbutton('enable');
                    $("#btn_delete_in_page_toolbar").linkbutton('enable');
                } else {
                    $("#btn_edit_in_page_toolbar").linkbutton('disable');
                    $("#btn_delete_in_page_toolbar").linkbutton('disable');
                }
            },
            onLoadSuccess: function () {
                tableObject_3.datagrid('selectRow', 0);
            },
            toolbar: [
                {
                    text: '<span class="tool-btn-refresh"><i class="fa fa-refresh"></i>刷新</span>',
                    plain: true,
                    handler: function () {
                        tableObject_3.datagrid('reload');
                    }
                },
            ]

        };
        var configDatagrid_4 = {
            url: '/api/LibWordEnMeaning/getLibWordEnMeaningOption',
            method: 'post',
            remoteSort: false,
            queryParams: {},
            pageList: [30, 50, 100],
            pageSize: 30,
            pagination: false,
            clickToEdit: false,
            dblclickToEdit: false,
            singleSelect: true,
            checkOnSelect: false,
            selectOnCheck: true,
            rownumbers: false,
            striped: true,
            fitColumns: true,
            fit: true,
            frozenColumns: [[
                {field: 'ck', title: 'ck', checkbox: true},
            ]],
            columns: [[
                {field: 'id', title: 'ID', width: 40, hidden: true},
                {field: 'meaning_en', title: '释义', width: 600},
            ]],
            loadFilter: function (data) {
                return loadFilter(data, false);
            },
            onClickRow: function (index, row) {
                // console.log("enter click row");
                // selectLeftMainId = row.id;
                // configDatagrid_2.queryParams = {datagrid_id:row.id};
                // tableObject_2.datagrid(configDatagrid_2);
            },
            onCheck: function (index, row) {
                var checkList = tableObject_3.datagrid('getChecked');
                if (checkList.length > 1) {
                    $("#btn_edit_in_page_toolbar").linkbutton('disable');
                } else if (1 == checkList.length) {
                    $("#btn_edit_in_page_toolbar").linkbutton('enable');
                    $("#btn_delete_in_page_toolbar").linkbutton('enable');
                }
            },
            onUncheck: function (index, row) {
                var checkList = tableObject_3.datagrid('getChecked');
                if (checkList.length > 1) {
                    $("#btn_edit_in_page_toolbar").linkbutton('disable');
                } else if (1 == checkList.length) {
                    $("#btn_edit_in_page_toolbar").linkbutton('enable');
                    $("#btn_delete_in_page_toolbar").linkbutton('enable');
                } else {
                    $("#btn_edit_in_page_toolbar").linkbutton('disable');
                    $("#btn_delete_in_page_toolbar").linkbutton('disable');
                }
            },
            onLoadSuccess: function () {
                tableObject_4.datagrid('selectRow', 0);
            },
            toolbar: [
                {
                    text: '<span class="tool-btn-refresh"><i class="fa fa-refresh"></i>刷新</span>',
                    plain: true,
                    handler: function () {
                        tableObject_3.datagrid('reload');
                    }
                },
                {
                    text: '<span class="tool-btn-add"><i class="fa fa-plus"></i>新增</span>',
                    plain: true,
                    handler: function () {
                        var rows = tableObject_3.datagrid("getChecked");
                        if (0 == rows.length) {
                            layer.msg("请勾选要加入的单词");
                            return false;
                        }
                        var arrCheckId = [];
                        $.each(rows, function (index, item) {
                            arrCheckId.push(item.id);
                        });
                        $.ajax({
                            url: '/api/LibMovieWord/addMultiLibMovieWordById',
                            type: 'post',
                            data: {movie_id: selectLeftMainId, arr_id: arrCheckId},
                            dataType: 'json',
                            success: function (resp) {
                                if (1 == resp.code) {
                                    tableObject_3.datagrid('reload');
                                } else {
                                    layer.msg(resp.message);
                                }
                            }
                        });
                    }
                },
                {
                    text: '<span class="tool-btn-delete"><i class="fa fa-trash"></i>删除</span>',
                    plain: true,
                    handler: function () {
                        var arrCheckId = getDatagridCheckedRowId(tableObject_3, "删除");
                        if (!arrCheckId) {
                            return false;
                        }
                        var confirm = layer.confirm('你确定要删除?', {title: '执行操作', btn: ['是', '否']}, function () {
                            $.ajax({
                                url: '/api/DatagridToolbar/deleteMultiDatagridToolbar',
                                type: 'post',
                                data: {"arr_id": arrCheckId},
                                dataType: 'json',
                                success: function (resp) {
                                    layer.close(confirm);
                                    if (1 == resp.code) {
                                        tableObject_3.datagrid('reload');
                                    } else {
                                        layer.msg(resp.message);
                                    }
                                }
                            });
                        });
                    }
                }
            ]

        };
        var configDatagrid_5 = {
            url: '/api/LibMovieSubtitle/getLibMovieSubtitleList',
            method: 'post',
            remoteSort: false,
            queryParams: {},
            pageList: [30, 50, 100],
            pageSize: 30,
            pagination: true,
            clickToEdit: false,
            dblclickToEdit: false,
            singleSelect: false,
            checkOnSelect: false,
            selectOnCheck: true,
            rownumbers: false,
            striped: true,
            fitColumns: true,
            fit: true,
            frozenColumns: [[
                {field: 'ck', title: 'ck', checkbox: true},
            ]],
            columns: [[
                {field: 'id', title: 'ID', width: 40, hidden: true},
                {field: 'subtitle_lang', title: '语种', width: 100},
                {field: 'subtitle', title: '字幕', width: 800},
            ]],
            loadFilter: function (data) {
                return loadFilter(data, true);
            },
            onClickRow: function (index, row) {
                // console.log("enter click row");
                // selectLeftMainId = row.id;
                // configDatagrid_2.queryParams = {datagrid_id:row.id};
                // tableObject_2.datagrid(configDatagrid_2);
            },
            onCheck: function (index, row) {
                var checkList = tableObject_3.datagrid('getChecked');
                if (checkList.length > 1) {
                    $("#btn_edit_in_page_toolbar").linkbutton('disable');
                } else if (1 == checkList.length) {
                    $("#btn_edit_in_page_toolbar").linkbutton('enable');
                    $("#btn_delete_in_page_toolbar").linkbutton('enable');
                }
            },
            onUncheck: function (index, row) {
                var checkList = tableObject_3.datagrid('getChecked');
                if (checkList.length > 1) {
                    $("#btn_edit_in_page_toolbar").linkbutton('disable');
                } else if (1 == checkList.length) {
                    $("#btn_edit_in_page_toolbar").linkbutton('enable');
                    $("#btn_delete_in_page_toolbar").linkbutton('enable');
                } else {
                    $("#btn_edit_in_page_toolbar").linkbutton('disable');
                    $("#btn_delete_in_page_toolbar").linkbutton('disable');
                }
            },
            onEndEdit: function (index, row, changes) { //在完成编辑但编辑器还没有销毁之前触发
                if (JSON.stringify(changes) != '{}') {
                    var updateData = $.extend({id: row.id}, changes);
                    $.ajax({
                        url: '/api/DatagridToolbar/simpleUpdateDatagridToolbar',
                        type: 'post',
                        data: updateData,
                        dataType: 'json',
                        async: false,
                        success: function (resp) {
                            if (0 == resp.code) {
                                layer.msg(resp.message);
                            } else {
                                tableObject_3.datagrid('reload');
                            }
                        }
                    });
                }
            },
            onLoadSuccess: function () {
                $("#btn_edit_in_page_toolbar").linkbutton('disable');
                $("#btn_delete_in_page_toolbar").linkbutton('disable');
                $(".switchbtn-pagetoolbar").switchbutton({
                    height: 18,
                    onText: "是",
                    offText: "否",
                    onChange: function (value) {
                        var newValue = value ? 1 : 2;
                        var pageToolbarId = $(this).data("id");
                        var fieldName = $(this).data("field");
                        togglePageToolbar(pageToolbarId, fieldName, newValue);
                    }
                })
            },
            toolbar: [
                {
                    text: '<span class="tool-btn-refresh"><i class="fa fa-refresh"></i>刷新</span>',
                    plain: true,
                    handler: function () {
                        tableObject_3.datagrid('reload');
                    }
                },
                {
                    text: '<span class="tool-btn-add"><i class="fa fa-plus"></i>新增</span>',
                    plain: true,
                    handler: function () {
                        var rows = tableObject_3.datagrid("getChecked");
                        if (0 == rows.length) {
                            layer.msg("请勾选要加入的单词");
                            return false;
                        }
                        var arrCheckId = [];
                        $.each(rows, function (index, item) {
                            arrCheckId.push(item.id);
                        });
                        $.ajax({
                            url: '/api/LibMovieWord/addMultiLibMovieWordById',
                            type: 'post',
                            data: {movie_id: selectLeftMainId, arr_id: arrCheckId},
                            dataType: 'json',
                            success: function (resp) {
                                if (1 == resp.code) {
                                    tableObject_3.datagrid('reload');
                                } else {
                                    layer.msg(resp.message);
                                }
                            }
                        });
                    }
                },
                {
                    text: '<span class="tool-btn-delete"><i class="fa fa-trash"></i>删除</span>',
                    plain: true,
                    handler: function () {
                        var arrCheckId = getDatagridCheckedRowId(tableObject_3, "删除");
                        if (!arrCheckId) {
                            return false;
                        }
                        var confirm = layer.confirm('你确定要删除?', {title: '执行操作', btn: ['是', '否']}, function () {
                            $.ajax({
                                url: '/api/DatagridToolbar/deleteMultiDatagridToolbar',
                                type: 'post',
                                data: {"arr_id": arrCheckId},
                                dataType: 'json',
                                success: function (resp) {
                                    layer.close(confirm);
                                    if (1 == resp.code) {
                                        tableObject_3.datagrid('reload');
                                    } else {
                                        layer.msg(resp.message);
                                    }
                                }
                            });
                        });
                    }
                }
            ]

        };

        tableObject_1.datagrid(configDatagrid_1);
        // tableObject_2.datagrid(configDatagrid_2);
        // tableObject_3.datagrid(configDatagrid_3);
        // tableObject_5.datagrid(configDatagrid_5);

        SearchCombobox(searchInputId_1, tableId_1, function (val, name) {
            configDatagrid_1.queryParams = {};
            configDatagrid_1.queryParams[name] = val;
            tableObject_1.datagrid(configDatagrid_1);
        }, ['ck', 'ID']);

        SearchCombobox(searchInputId_3, tableId_3, function (val, name) {
            configDatagrid_3.queryParams = {};
            configDatagrid_3.queryParams[name] = val;
            tableObject_3.datagrid(configDatagrid_3);
        }, ['ck', 'ID']);

        function togglePageToolbar(pageToolbarId, fieldName, value) {
            console.log("update page toolbar", pageToolbarId);
            $.ajax({
                url: '/api/DatagridToolbar/toggleDatagridToolbar',
                type: 'post',
                data: {id: pageToolbarId, field_name: fieldName, value: value},
                dataType: 'json',
                async: false,
                success: function (resp) {
                    if (0 == resp.code) {
                        layer.msg(resp.message);
                    }
                }
            });
        }

    });

</script>